//
//  YKPromoteDataItemCell.m
//  YunKang
//
//  Created by leoking870 on 2017/10/5.
//  Copyright © 2017年 leoking870. All rights reserved.
//

#import "YKPromoteDataItemCell.h"
#import "YKDashView.h"


@interface YKPromoteDataItemCell ()
@property (weak, nonatomic) IBOutlet UILabel *productNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *clientNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *salesmanLabel;
@property (weak, nonatomic) IBOutlet UILabel *addDateLabel;

@end


@implementation YKPromoteDataItemCell
@dynamic tableViewItem;
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)cellLoadSubViews {
    [super cellLoadSubViews];
    self.productNameLabel.tf_weight = 1;
    self.clientNameLabel.tf_weight = 2;
    self.salesmanLabel.tf_weight = 1;
    self.addDateLabel.tf_weight = 1;
    
    self.salesmanLabel.textAlignment = NSTextAlignmentCenter;
    self.addDateLabel.textAlignment = NSTextAlignmentCenter;
    
    [@[self.productNameLabel, self.clientNameLabel, self.salesmanLabel,self.addDateLabel] mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.top.equalTo(self.contentView.mas_top).offset(11);
    }];
    
    [@[self.productNameLabel, self.clientNameLabel, self.salesmanLabel,self.addDateLabel] mas_alignWeightlyAlongAxis:MASAxisTypeHorizontal
                                                                                                             fixedSpace:@2
                                                                                                              leadingTo:self.contentView.mas_leading
                                                                                                              leadSpace:13
                                                                                                             trailingTo:self.contentView.mas_trailing
                                                                                                              tailSpace:13];
    
    YKDashView* dashView = [[YKDashView alloc]init];
    dashView.lineWidth = .5f;
    dashView.lineColor = [UIColor tf_colorWithHexString:@"#d4d4d4"];
    dashView.dashLineLength = 3;
    [self addSubview:dashView];
    [dashView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.bottom.trailing.equalTo(self);
        make.height.mas_equalTo(1);
    }];
}


- (void)cellWillAppear {
    [super cellWillAppear];
    self.productNameLabel.text = self.tableViewItem.model.CINV_NAME;
    self.clientNameLabel.text = self.tableViewItem.model.C_NAME;
    self.salesmanLabel.text = self.tableViewItem.model.USER_NAME;
    self.addDateLabel.text = self.tableViewItem.model.OPERATIONTIME;
}


@end
